package com.example.administrator.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class MyActivity2 extends AppCompatActivity {
    TextView  mTvUserName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my2);
        //获取意图对象

        Intent intent =getIntent();
        Bundle bundle =intent.getExtras();
        String username =bundle.getString("username");
        //显示数据
        //获取控件，修改控件的属性值
        mTvUserName=findViewById(R.id.tv_username);
        mTvUserName.setText(username);
    }
}
